question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to work with viewbox settings

See original GitHub issue

Hey all,

total noob here, we have a json file we are trying to load as an SVG animation on WebFlow, I have a div element named bodymovin-1, and im loading the SVG inside that div… i wanted the animation to fill the div and also align it left… I figured out the preserve aspect ration stuff, but i can’t figure out where to add the viewbox part, or if thats even the right way to do it… any help here would be amazing

`<script> var loader = document.getElementsByClassName(“bodymovin-1”); function loadBMAnimation(loader) { var animation = bodymovin.loadAnimation({ container: loader, renderer: “svg”, loop: true, autoplay: true, viewBox: ‘700 0 2400 590’, is this the correct place to add it? rendererSettings: { progressiveLoad:false, preserveAspectRatio: ‘xMaxYMax slice’ }, path: “https://gist.githubusercontent.com/sirharjisingh/fe3b442b7eaa3cdf3065a97d10596f3a/raw/6df5406fabf2f14d3c1847ecf110735d00ee7b6c/logo.json” }); }

for (var i = 0; i < loader.length; i++) { loadBMAnimation(loader[i]); } </script>’

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
sirharjisinghcommented, Apr 19, 2019

Damn, not all heros wear capes…

haha, thank you.

0reactions
bodymovincommented, Apr 20, 2019

closing, reopen if necessary

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG Viewport and viewBox (For Complete Beginners)
In this quick SVG viewport and viewBox tutorial, we're going to break down exactly what viewport and viewBox are in SVG for the...
Read more >
viewBox - SVG: Scalable Vector Graphics - MDN Web Docs
The viewBox attribute defines the position and dimension, in user space, of an SVG viewport.
Read more >
SVG viewBox Attribute - GeeksforGeeks
The viewBox is an attribute of the SVG element in HTML. It is used to scale the SVG element that means we can...
Read more >
Understand the SVG Viewbox - DigitalOcean
The viewBox is a very useful tool to crop our images. The easiest way to crop the image is by using the min...
Read more >
SVG Viewport and View Box - Jenkov.com
Depending on how you want to align the view box within the viewport, you may use different settings. I will get a bit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found