Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@proyecto26/animatable-component
Advanced tools
<animatable/>
Web Component built with Stencil.js to use Web Animations API in a declarative way. You can animate any HTML element easily:
<animatable-component
autoplay
easing="ease-in-out"
duration="800"
delay="300"
animation="tada"
>
<h1>Hello World</h1>
</animatable-component>
With the largest list of Keyframes/Easing Functions that can also be used with other animation tools or Platforms! 🧚
Do you want to see this web component in action? Visit https://codepen.io/jdnichollsc/full/rNNYBbe yay! 🎉
<animatable />
, a tiny Web Component: https://dev.to/jdnichollsc/meet-animatable-a-tiny-web-component-to-use-web-animations-api-as-a-component-1glh<animatable-component autoplay iterations="3" animation="heartBeat" easing="ease-in" duration="1000">
<h1>Proof that Tony Stark has a heart ✵</h1>
</animatable-component>
<animatable-cube
autoplay
fill="forwards"
composite="add"
duration="2600"
easing="linear"
iterations="Infinity"
fromClassName="playing"
toClassName="finished"
animation="rotate-90-vertical-bck"
>
<div slot="front-face">Front</div>
<div slot="back-face">Back</div>
<div slot="right-face">Right</div>
<div slot="left-face">Left</div>
<div slot="top-face">Top</div>
<div slot="bottom-face">Bottom</div>
</animatable-cube>
import {
ANIMATIONS,
EASING_FUNCTIONS,
EASING,
KEYFRAMES
} from '@proyecto26/animatable-component';
const bounceKeyFrames = KEYFRAMES[ANIMATIONS.BOUNCE];
const easingOutCubic = EASING_FUNCTIONS[EASING.EASE_OUT_CUBIC];
// Use here any other animation tool :)
Project | Package | Version | Links |
---|---|---|---|
Core | @proyecto26/animatable-component | README.md | |
React | @proyecto26/animatable-component-react | README.md |
<script src='https://unpkg.com/animatable-component@1.1.5/dist/animatable-component.js'></script>
in the head of your index.htmlnpm install @proyecto26/animatable-component --save
<script src='node_modules/@proyecto26/animatable-component/dist/animatable-component.js'></script>
in the head of your index.htmlnpm install @proyecto26/animatable-component --save
import @proyecto26/animatable-component;
Using animatable-component
component within an Angular project:
Including the CUSTOM_ELEMENTS_SCHEMA
in the module allows the use of Web Components in the HTML files. Here is an example of adding it to AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
The CUSTOM_ELEMENTS_SCHEMA
needs to be included in any module that uses Animatable.
Animatable component includes a function used to load itself in the application window object. That function is called defineCustomElements()
and needs to be executed once during the bootstrapping of your application. One convenient place to add it is in the main.ts
file as follows:
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
defineAnimatable(window);
When using a wrapper component, It's not necessary to access the reference directly to attach events, etc. More details here.
import React from 'react';
import {
AnimatableComponent,
ANIMATIONS,
EASING
} from '@proyecto26/animatable-component-react';
const App = () => {
return (
<AnimatableComponent
autoPlay
delay={300}
duration={800}
composite='add'
direction='alternate'
iterations={Infinity}
animation={ANIMATIONS.TADA}
easing={EASING.EASE_IN_OUT_BACK}
onStart={() => console.log('Starting animation')}
onFinish={() => console.log('Finished animation')}
onCancel={() => console.log('Cancelled animation')}
>
<div>
<p>HELLO WORLD</p>
</div>
</AnimatableComponent>
);
};
export default App;
Other option is using the web component directly:
import React from 'react'
import ReactDOM from 'react-dom'
import { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader'
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
defineAnimatable(window);
In order to use the animatable-component
Web Component inside of a Vue application, it should be modified to define the custom elements and to inform the Vue compiler which elements to ignore during compilation. This can all be done within the main.js
file as follows:
import Vue from 'vue';
import { defineCustomElements as defineAnimatable } from '@proyecto26/animatable-component/loader'
import App from './App.vue';
Vue.config.productionTip = false;
Vue.config.ignoredElements = [/animatable-\w*/];
// Bind the custom element to the window object
defineAnimatable(window);
new Vue({
render: h => h(App)
}).$mount('#app');
To animate Functional Components you can use the createAnimatableComponent
utility, e.g:
utils.tsx
import {
createAnimatableComponent
} from '@proyecto26/animatable-component';
const SendMessageButton = (props) => (
<ion-fab-button {...props}>
<ion-icon name='send' />
</ion-fab-button>
);
export const AnimatableSendMessageButton = createAnimatableComponent(SendMessageButton);
export const keyFramesSendMessage: Keyframe[] = [
{
opacity: '0',
transform: 'rotate(0deg)'
},
{
opacity: '1',
transform: 'rotate(360deg)'
}
];
export const optionsSendMessage: KeyframeAnimationOptions = {
duration: 500,
easing: 'ease-in-out'
};
my-component.tsx
import { Component, Host, h } from '@stencil/core';
import { AnimatableSendMessageButton, keyFramesSendMessage, optionsSendMessage } from './utils'
@Component({
tag: 'my-component',
shadow: false
})
export class MyComponent {
render() {
return (
<AnimatableSendMessageButton
autoPlay
keyFrames={keyFramesSendMessage}
options={optionsSendMessage}
onFinish={() => alert('Eureka!')}
/>
)
}
}
I believe in Unicorns 🦄 Support me, if you do too.
Available as part of the Tidelift Subscription.
The maintainers of <animatable/>
and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
Made with ❤️
[1.1.5] - 2020-04-23
animatable-cube
component by adding missing css variables as props.animatable-component
to be loaded as a custom element.FAQs
Animate once, use Everywhere! 💫
The npm package @proyecto26/animatable-component receives a total of 785 weekly downloads. As such, @proyecto26/animatable-component popularity was classified as not popular.
We found that @proyecto26/animatable-component demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.