I'm stuck and I spend a whole day on this issue. Basically I'm trying to implement in my website an animation, using Lottie. The format of my animation is 1080*1920. The problem is that, given a div
, with:
width: auto; height: auto;
or width: 100%; height: 100%;
the exported animation is always bigger than the enclosing parent. This problem arise specially with the smartphone sized-screens. I tried to change all the parameters, unsuccessfully. I even touched the java script code, in Lottie, you can specify the rendered options:
You can see the animation here:
import './styles/main.scss'
const lottie = require('lottie-web')
const bodymovin = require('bodymovin')
var svgContainer = document.getElementById('homeSection');
var animData = {
container: svgContainer,
renderer: 'svg',
loop: false,
autoplay:true,
path: 'PhoneRotate.json'
};
var anim = lottie.loadAnimation(animData);
@import "~bootstrap/scss/bootstrap";
html, body {
background-color: #000;
overflow: scroll;
}
.section1{
background-color: black;
width: 100%;
height:100%;
}
.section2{
background-image: radial-gradient(farthest-side at 0 100%,rgba(69,134,247,.3),rgba(69,134,247,0)),radial-gradient(farthest-side at 100% 100% ,rgba(60,221,221,.4),rgba(60,221,221,0)),radial-gradient(farthest-side at 100% 50%,rgba(98,217,245,.1),rgba(98,217,245,0));
width: 100%;
height:100%;
}
.section3{
background-image: radial-gradient(farthest-side at 0 0,rgba(69,134,247,.3),rgba(69,134,247,0)),radial-gradient(farthest-side at 100% 0,rgba(60,221,221,.4),rgba(60,221,221,0)),radial-gradient(farthest-side at 50% 50%,rgba(98,217,245,.1),rgba(98,217,245,0));
width: 100%;
height:100%;
}
#homeSection {
height: auto;
border-style: solid;
border-color: yellow;
position: absolute;
right: 5px;
left: 5px;
}
<div>
<nav class="navbar navbar-expand-lg navbar-custom" >
<a class="navbar-brand">
<img class="logo " src="images/AM_logo.png" href="#">
</a>
<a class="navbar-brand" style="color: black"> Arduino Developer </a>
</nav>
</div>
<div class="container-fluid section1" >
<div id="homeSection">
<div>
<p class="text textH"> TEXT 1</p>
</div>
<div>
<p class="text textT"> TEXT2</p>
</div>
</div>
</div>