Create transformations based on a square defining the view port for animations and dynamic framing. This is based on the old but really great dCam source by @Luckyde.
I came across a small issue, that when using regular boxes instead of a symbol in Hype the transformation is slightly off duo to the way Hype reports width and height including borders. Hence, I added some CSS to create the border on the camera in this example. This CSS was added to the code base starting from version 1.2.4 and remember to avoid Hype native borders on cameras for the highest precision.
↑ look at project 1.2.4 Added border style for IDE, HypeDynamicCamera.hideBorderInIDE, .dynamic-camera-no-border and --dynamic-camera-border
I added the border for the cameras through the extension because adding them using the Hype API introduces calculation problems (as Hype adds the border width in contrast to the default box model). Every rectangle that gets the additional attribute data-dynamic-camera also gets a border. Remove any border in Hype for most precise results. These borders are only applied in the Hype IDE. If you want to disable borders on a specific camera, just add dynamic-camera-no-border as a class. If you want to have a specific border, just define and add a class setting the CSS variable --dynamic-camera-border either as a class name or :root
.dynamic-camera-green-border {
--dynamic-camera-border: solid green 4px;
}
I updated all the example files to use the built-in border, rather than one added through Hype.
If for some reason you want to hide borders in the IDE you can add HypeDynamicCamera.hideBorderInIDE() to Head HTML in a script tag.
Playing around with parsing skew and I also replaced the one remaining Matrix calculation with a getter from the API. Also, adding support to retain the translation of the stage in a multi stage setup.
I'm trying to combine the use of 'dynamic camera' and the 'drag and drop enabler'. The dynamic cam GPS interferes with the drag and drop enabler GPS. See example attached.
Is there somehow an option for them not to interfere with each other?
___Ignore my questions. Let me do the homework first______Do I run the nudgeFunction on every animation of the wrapper, and when I reset the the wrapper position and size, do I have to reverse the nudge somehow, or just run it again?
technical background: the whole setup for positionings is handled by the script onload of a scene, on resize of the window and if involved elements attributes are changed. so far so good, but if just the wrapperelements attributes change (your case) the script by default won't react ... this is why it has to be nudged to make an update ... (bit dirty by dispatching the resizeevent ...)
Thanks @h_classen. This could work. I will explore further. Thank you for the extension. I love working with it.
@MaxZieb after imagining the possibilities of using the DD enabler and dynamic camera together, is there a way there could be a 'nudge' function that will re-align the positioning after a camera move?
As Hannes said there is no easy way to make it compatible. Hype Dynamic Camera was a project I picked up from a previous active community member and it is based on setting a CSS transform manually so the Hype Runtime doesn’t “know” about any of the scaling . this has some advantages but one downside is that the math for the dragging pointer alignment doesn’t work anymore. Meaning it is not compatible with the built and dragging functionality.