Movin bodymovin
How do I make an movin bodymovin?
Toggle between the Canvas and the Svg renders. These animations are exported from After Effects and animated with javascript. . What is a movin bodymovin? How do you make a movin bodymovin? This script and codes were developed by Kittons on 09 September 2022, Friday.
Movin bodymovin - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Movin bodymovin</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="canvasContainer" class="container"></div>
<div id="svgContainer" class="container"></div>
<div id="switchContainer"> <canvas id="svgSwitch" width="100" height="30"></canvas> <div id="canvasSwitch"></div>
</div> <script src='https://labs.nearpod.com/bodymovin/demo/bm/bodymovin3.js'></script>
<script src='https://labs.nearpod.com/bodymovin/demo/bm/data.js'></script>
<script src='https://labs.nearpod.com/bodymovin/demo/bm/canvasSwitchData.js'></script>
<script src='https://labs.nearpod.com/bodymovin/demo/bm/svgSwitchData.js'></script> <script src="js/index.js"></script>
</body>
</html>
Movin bodymovin - Script Codes CSS Codes
body{ background-color: black; margin:0; overflow:hidden;
}
.container{ width:100%; height:100%; position: absolute; top: 0; left: 0; bottom: 0; right: 0; margin: auto;
}
#switchContainer{ width:100px; height:30px; position: absolute; top: 20px; right: 20px; cursor: pointer;
}
#canvasSwitch{ width:100%; height:100%; display: none;
}
Movin bodymovin - Script Codes JS Codes
var canvasContainer = document.getElementById('canvasContainer'); var svgContainer = document.getElementById('svgContainer'); var canvasAnim = bodymovin.loadAnimation({ wrapper: canvasContainer, animType: 'canvas', loop: true, autoplay: false, prerender: false, animationData: JSON.parse(animationData) }); var svgAnim = bodymovin.loadAnimation({ wrapper: svgContainer, animType: 'svg', loop: true, autoplay: false, prerender: false, animationData: JSON.parse(animationData) }); var currentDisplay; var switchContainer = document.getElementById('switchContainer'); var canvasSwitch = document.getElementById('canvasSwitch'); var svgSwitch = document.getElementById('svgSwitch'); var canvasSwAnim = bodymovin.loadAnimation({ wrapper: canvasSwitch, animType: 'svg', loop: false, autoplay: false, prerender: false, animationData: JSON.parse(svgSwitchData) }); var svgSwAnim = bodymovin.loadAnimation({ animType: 'canvas', loop: false, autoplay: false, prerender: false, renderer:{ clearCanvas: true, context: svgSwitch.getContext('2d'), scaleMode: 'fit' }, animationData: JSON.parse(canvasSwitchData) }); function show(type){ currentDisplay = type; if(type == 'canvas'){ canvasContainer.style.display = 'block'; svgContainer.style.display = 'none'; canvasAnim.goToAndStop(svgAnim.currentFrame,true); svgAnim.pause(); canvasAnim.play(); canvasSwitch.style.display = 'block'; svgSwitch.style.display = 'none'; canvasSwAnim.goToAndStop(0); canvasSwAnim.play(); svgSwAnim.pause(); }else{ canvasContainer.style.display = 'none'; svgContainer.style.display = 'block'; svgAnim.goToAndStop(canvasAnim.currentFrame,true); canvasAnim.pause(); svgAnim.play(); svgSwitch.style.display = 'block'; canvasSwitch.style.display = 'none'; svgSwAnim.goToAndStop(0); svgSwAnim.play(); canvasAnim.pause(); } } function toggleDisplay(){ if(currentDisplay == 'canvas'){ show('svg'); }else{ show('canvas'); } } function resize(){ canvasAnim.resize(); } show('svg'); switchContainer.onclick = toggleDisplay; window.onresize = resize;
Developer | Kittons |
Username | airnan |
Uploaded | September 09, 2022 |
Rating | 4.5 |
Size | 2,574 Kb |
Views | 91,080 |
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!
Name | Size |
Murally | 1,789 Kb |
Mc A from Beastie boys | 1,825 Kb |
Dotskin | 2,894 Kb |
Don dalek | 1,830 Kb |
Svg jou jou monster | 2,116 Kb |
Shapes | 1,817 Kb |
The Glitcher | 2,260 Kb |
A christmas loop in svg | 2,227 Kb |
After Effects to PIXI.js | 1,866 Kb |
Perricorn. a dog that was a unicorn | 1,893 Kb |
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!
Name | Username | Size |
Javascript Welcome | Peterlewicki | 1,573 Kb |
Impress JS Algorhytmic Generator | Jeffscottward | 7,906 Kb |
Fun animations with CSS3 | Minimalmonkey | 2,360 Kb |
Vertically rotating text with CSS | Nopr | 2,141 Kb |
A Pen by Moeid Saleem | Moeidsaleem | 1,862 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Plotting Points with D3.js | Laurakelly | 31,996 Kb |
Navcube | Wbarlow | 4,775 Kb |
Hexagons | Ashmind | 4,360 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!