Socket
Socket
Sign inDemoInstall

doper

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    doper

A dom wrapper for animation/positioning


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Dom Wrapper

What is this tool for ?

With this tool, you can manipulate the position/rotation/scale of dom element with a much easy way. Including:

  • x
  • y
  • width
  • height
  • scale
  • scaleX
  • scaleY
  • rotation
  • pivot
  • minAnchor
  • maxAnchor
  • parent
  • html
  • css

and many more...

All the attributes are behave separately, and auto refreshs the dom correspondingly while you assigning them. Much like a UGUI way to control your dom elements. Works perfectly with other animation libraries (e.g. tween)

Examples

let node = doper('<div>Hello World!</div>', '.container');

node.parent.style.position = 'relative';
node.style.backgroundColor = '#789';

// 居中
node.minAnchorX = 0.5;
node.maxAnchorX = 0.5;
node.minAnchorY = 0.5;
node.maxAnchorY = 0.5;

function update() {
	node.rotation++;
	node.y = Math.sin(node.rotation * 0.05) * 100;
	requestAnimationFrame(update);
}

update();
Result:

https://i.imgur.com/JxPoBs1.gif

Keywords

FAQs

Last updated on 26 Apr 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc