highcharts - present halo animation in Highmap -
i'm digging highcharts/highmaps now. need help.
occasion is: when server give me lat/lon information, present halo animation according lat/lon. problem animation.
desired animation this
/*css*/ body { background-color: black; } #circle-1 { display: block; width: 40px; height: 40px; border-radius: 40px; opacity: 0; animation-name: scale; animation-duration: 3s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes scale { 0% { transform: scale(0.1); opacity: 0; box-shadow: 0px 0px 50px rgba(255, 255, 255, 0.5); } 50% { transform: scale(0.5); opacity: 1; box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.5); } 100% { transform: scale(1); opacity: 0; box-shadow: 0px 0px 20px rgba(255, 255, 255, 0); } } //js var renderer; $(function () { renderer = new highcharts.renderer( $('#container')[0], 400, 300 ); drawcircle(); }); function drawcircle(){ renderer.circle(200, 150, 20).attr({ id:'circle-1', fill: '#fcffc5', stroke: 'black', 'stroke-width': 1 }).add(); }
this animation far can do, check jsfiddle out.
html, body { overflow: hidden; background: #111; } .hole { position: absolute; top: 50%; left: 50%; z-index: 2000; } { display: block; position: absolute; width: 40px; height: 40px; left: 0px; top: 0px; border-radius: 40px; opacity: 0; animation-name: scale; animation-duration: 3s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes scale { 0% { transform: scale(0.1); opacity: 0; box-shadow: 0px 0px 50px rgba(255, 255, 255, 0.5); } 50% { transform: scale(1) translate(0px, -5px); opacity: 1; box-shadow: 0px 0px 20px rgba(255, 255, 255, 0.5); } 100% { transform: scale(2) translate(0px, 5px); opacity: 0; box-shadow: 0px 0px 20px rgba(255, 255, 255, 0); } }
i want circle stay right there scaling , opacity change. when apply scale, seems scales according left top corner. sincerely appreciated.
in transform
should use original translate position scaled (1 - scale) values, scale(0.1) there translate(180px, 135px), because 180 = 200 * (1 - 0.1) , 135 = 150 * (1 - 0.1).
to same circle use fill gradient like:
fill: { radialgradient: { cx: 0.5, cy: 0.5, r: 0.5 }, stops: [ [0, 'none'], [0.5, 'rgba(0,0,0,0)'], [0.5, 'rgba(255,255,255,0.5)'], [1, 'rgba(0,0,0,0)'] ] },
example: http://jsfiddle.net/ygzkyv17/
var renderer; $(function() { renderer = new highcharts.renderer( $('#container')[0], 400, 300 ); drawcircle(); }); function drawcircle() { renderer.circle(200, 150, 40).attr({ id: 'circle-1', fill: { radialgradient: { cx: 0.5, cy: 0.5, r: 0.5 }, stops: [ [0, 'none'], [0.5, 'rgba(0,0,0,0)'], [0.5, 'rgba(255,255,255,0.5)'], [1, 'rgba(0,0,0,0)'] ] }, stroke: 'black', 'stroke-width': 1 }).add(); }
body { background-color: black; } #circle-1 { display: block; width: 40px; height: 40px; border-radius: 40px; opacity: 0; animation-name: scale; animation-duration: 3s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes scale { 0% { transform: translate(180px, 135px) scale(0.1); opacity: 0; box-shadow: 0px 0px 50px rgba(255, 255, 255, 0.5); } 50% { transform: translate(100px, 75px) scale(0.5); opacity: 1; box-shadow: 0px 8px 20px rgba(255, 255, 255, 0.5); } 100% { transform: translate(0px, 0px) scale(1); opacity: 0; box-shadow: 0px 10px 20px rgba(255, 255, 255, 0); } }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <div id="container" style="height: 500px"></div>
Comments
Post a Comment