Anaglyph 3D with CSS-blend on mouseMove

Size
2,982 Kb
Views
60,720

How do I make an anaglyph 3d with css-blend on mousemove?

Trying the "new" feature of CSS-blend mode on a black&white image. There is a mouseMove animation that makes the stuff funnier :). What is a anaglyph 3d with css-blend on mousemove? How do you make a anaglyph 3d with css-blend on mousemove? This script and codes were developed by Robert Borghesi on 27 August 2022, Saturday.

Anaglyph 3D with CSS-blend on mouseMove Previews

Anaglyph 3D with CSS-blend on mouseMove - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Anaglyph 3D with CSS-blend on mouseMove</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="info">it's experimental <br>could not work in some old browsers</div>
<div class="mouse">move <br> your mouse</div>	<div class="container">	<div>	<img src="http://s22.postimg.org/j94yj6mxt/NORM.jpg" />	<img src="http://s22.postimg.org/wekgpagtd/BLUE.jpg" id="blu"/>	<img src="http://s22.postimg.org/lcfdqumqp/RED.jpg" id="red"/>	</div>	</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Anaglyph 3D with CSS-blend on mouseMove - Script Codes CSS Codes

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400);
.info { font-family: 'Open Sans', sans-serif; display: inline-block; position: fixed; top: 20px; right: 20px; text-transform: uppercase; font-size: 12px; text-align: right;
}
.mouse { font-family: 'Open Sans', sans-serif; display: inline-block; position: fixed; top: 20px; left: 20px; text-transform: uppercase; font-size: 12px; text-align: left;
}
.container { position: fixed; height: 100%; width: auto; bottom: 0; width: 100%;
}
img { position: absolute; max-height: 560px; bottom: -30px; margin: 0 auto; left: 0; right: 0;
}
#blu, #red { mix-blend-mode: lighten;
}
#blu { left: 0px;
}
#red { left: 0px;
}

Anaglyph 3D with CSS-blend on mouseMove - Script Codes JS Codes

$(document).ready(function() { var container = $(".container"); var mouseX, mouseY; var maxTrans = 10; var trax, tray; var ww = $(window).width(); var wh = $(window).height(); var centerX = ww/2; var centerY = wh/2; var ratio = maxTrans / ww; container.mousemove(function(e) { mouseX = e.pageX; mouseY = e.pageY; transX = mouseX; transY = mouseY; if(mouseY < centerY){	if(mouseX < centerX){	movestuff((centerX-mouseX)*ratio,(centerY-mouseY)*ratio);	}else{	movestuff(-(mouseX-centerX)*ratio,(centerY-mouseY)*ratio);	} } else{	if(mouseX < centerX){	movestuff((centerX-mouseX)*ratio,(mouseY-centerY)*ratio);	}else{	movestuff(-(mouseX-centerX)*ratio,(mouseY-centerY)*ratio);	} } });
$( window ).resize(function() { var centerX = ww/2; var centerY = wh/2;
});
});
function movestuff(moveX, moveY){	var blue = $("#blu");	var red = $("#red");	red.css({ transform: 'translate('+ moveX +'px, '+ moveY + 'px)', MozTransform: 'translate('+ moveX +'px, '+ moveY + 'px)', WebkitTransform: 'translate('+ moveX +'px, '+ moveY + 'px)', msTransform: 'translate('+ moveX +'px, '+ moveY + 'px)' }) blue.css({ transform: 'translate('+ -moveX +'px, '+ moveY + 'px)', MozTransform: 'translate('+ -moveX +'px, '+ moveY + 'px)', WebkitTransform: 'translate('+ -moveX +'px, '+ moveY + 'px)', msTransform: 'translate('+ -moveX +'px, '+ moveY + 'px)' })
}
Anaglyph 3D with CSS-blend on mouseMove - Script Codes
Anaglyph 3D with CSS-blend on mouseMove - Script Codes
Home Page Home
Developer Robert Borghesi
Username dghez
Uploaded August 27, 2022
Rating 4.5
Size 2,982 Kb
Views 60,720
Do you need developer help for Anaglyph 3D with CSS-blend on mouseMove?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Robert Borghesi (dghez) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!