Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

motion-effect

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

motion-effect - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

lib/commonjs/Album/index.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:()=>_default});const _interopRequireWildcard=require("@swc/helpers/lib/_interop_require_wildcard.js").default;const _jsxRuntime=require("react/jsx-runtime");const _react=_interopRequireWildcard(require("react"));const _framerMotion=require("framer-motion");function Album({children,text,subText,tag,duration=.6,...props}){const[isHover,setIsHover]=(0,_react.useState)(false);const[shadowSize,setShadowSize]=(0,_react.useState)({width:0,height:0});const containerRef=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{const bounds=containerRef.current.getBoundingClientRect();setShadowSize({width:bounds.width,height:bounds.height})},[]);return(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{ref:containerRef,initial:{width:"max-content",height:"max-content",position:"relative",cursor:"pointer",overflow:"hidden"},onHoverStart:()=>{setIsHover(true)},onHoverEnd:()=>{setIsHover(false)},...props,children:[tag&&(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{position:"absolute",top:"0px",left:"0px",padding:"0 8px",borderRadius:"0 0 4px",background:"#ffd75a",lineHeight:"28px",zIndex:3},children:tag}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{opacity:.5,zIndex:1},animate:{width:shadowSize.width,height:shadowSize.height,position:"absolute",opacity:isHover?1:.5,borderRadius:"3px",background:"linear-gradient(rgba(0,0,0,0) 0%,rgba(0,0,0,.25) 70%,rgba(0,0,0,.65) 100%)"},transition:{duration,width:{duration:0},height:{duration:0}}}),(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{width:"100%",height:"100%",padding:"8px"},children:[(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{position:"absolute",bottom:"8px",left:"16px",zIndex:2},children:[text,(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{height:"0px",opacity:0,zIndex:2,margin:"8px 0px"},animate:{height:isHover?"max-content":"0px",opacity:isHover?1:0,margin:isHover?"12px 0px":"8px 0px"},transition:{duration},children:subText})]}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{animate:{scale:isHover?1.05:1},transition:{duration},children:children})]})]})}const _default=Album;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:()=>_default});const _interopRequireWildcard=require("@swc/helpers/lib/_interop_require_wildcard.js").default;const _jsxRuntime=require("react/jsx-runtime");const _react=_interopRequireWildcard(require("react"));const _framerMotion=require("framer-motion");function Album({children,text,subText,tag,duration=.6,shadow=[.5,1],scaleSize=1.1,...props}){const[isHover,setIsHover]=(0,_react.useState)(false);const[shadowSize,setShadowSize]=(0,_react.useState)({width:0,height:0});const[from,to]=shadow;const containerRef=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{const bounds=containerRef.current.getBoundingClientRect();setShadowSize({width:bounds.width,height:bounds.height})},[]);return(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{ref:containerRef,initial:{width:"max-content",height:"max-content",position:"relative",cursor:"pointer",overflow:"hidden"},onHoverStart:()=>{setIsHover(true)},onHoverEnd:()=>{setIsHover(false)},...props,children:[tag&&(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{position:"absolute",top:"0px",left:"0px",padding:"0 8px",borderRadius:"0 0 4px",background:"#ffd75a",lineHeight:"28px",zIndex:3},children:tag}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{opacity:.5,zIndex:1},animate:{width:shadowSize.width,height:shadowSize.height,position:"absolute",opacity:isHover?to:from,borderRadius:"3px",background:"linear-gradient(rgba(0,0,0,0) 0%,rgba(0,0,0,.25) 70%,rgba(0,0,0,.65) 100%)"},transition:{duration,width:{duration:0},height:{duration:0}}}),(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{width:"100%",height:"100%",padding:"8px"},children:[(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{position:"absolute",bottom:"8px",left:"16px",zIndex:2},children:[text,(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{height:"0px",opacity:0,zIndex:2,margin:"8px 0px"},animate:{height:isHover?"max-content":"0px",opacity:isHover?1:0,margin:isHover?"12px 0px":"8px 0px"},transition:{duration},children:subText})]}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{animate:{scale:isHover?scaleSize:1},transition:{duration},children:children})]})]})}const _default=Album;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:()=>_default});const _interopRequireWildcard=require("@swc/helpers/lib/_interop_require_wildcard.js").default;const _jsxRuntime=require("react/jsx-runtime");const _react=_interopRequireWildcard(require("react"));const _framerMotion=require("framer-motion");function Typing({text,speed,conatinerStyle,textStyle,cursor}){const characters=(0,_react.useMemo)(()=>{return text.split("")},[text]);const typingSpeend=(0,_react.useMemo)(()=>{return speed<=0?1:1/speed},[speed]);return(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{display:"flex",alignItems:"flex-end"},style:conatinerStyle,children:[characters.map((character,index)=>{return(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{initial:{display:"none"},animate:{display:"block"},transition:{delay:(index+1)*typingSpeend},style:textStyle,children:character!==" "?(0,_jsxRuntime.jsx)(_framerMotion.motion.span,{children:character}):(0,_jsxRuntime.jsx)(_framerMotion.motion.span,{children:"\xa0"})},index)}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{animate:{opacity:[0,1]},transition:{type:"spring",repeat:Infinity,repeatType:"loop",duration:1},children:cursor?cursor:"_"})]})}const _default=Typing;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:()=>_default});const _interopRequireWildcard=require("@swc/helpers/lib/_interop_require_wildcard.js").default;const _jsxRuntime=require("react/jsx-runtime");const _react=_interopRequireWildcard(require("react"));const _framerMotion=require("framer-motion");function Typing({text,speed,conatinerStyle,textStyle,cursor,deleteDelay=3}){const[characters,setCharacters]=(0,_react.useState)([]);const typingSpeend=(0,_react.useMemo)(()=>{return speed<=0?1:1/speed},[speed]);const inputRef=(0,_react.useRef)(-1);const deleteRef=(0,_react.useRef)(-1);const[flag,setFlag]=(0,_react.useState)(true);const[index,setIndex]=(0,_react.useState)(0);(0,_react.useEffect)(()=>{const texts=text.split("");if(flag){inputRef.current=window.setInterval(()=>{if(index===texts.length-1){window.clearInterval(inputRef.current);window.setTimeout(()=>{setFlag(false)},deleteDelay*1e3)}setCharacters(s=>[...s,texts[index]]);setIndex(i=>i+1)},typingSpeend*1e3)}if(!flag){deleteRef.current=window.setInterval(()=>{if(index===0){setFlag(true);window.clearInterval(deleteRef.current)}setCharacters(s=>s.filter((c,i)=>i<s.length-2));setIndex(i=>i-1)},typingSpeend*300)}return()=>{window.clearInterval(inputRef.current);window.clearInterval(deleteRef.current)}},[text,typingSpeend,flag,index,deleteDelay]);return(0,_jsxRuntime.jsxs)(_framerMotion.motion.div,{initial:{display:"flex",alignItems:"flex-end"},style:conatinerStyle,children:[characters.map((character,index)=>{return(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{style:textStyle,initial:{visibility:"hidden"},animate:{visibility:["hidden","visible"]},children:character!==" "?(0,_jsxRuntime.jsx)(_framerMotion.motion.span,{children:character}):(0,_jsxRuntime.jsx)(_framerMotion.motion.span,{children:"\xa0"})},index)}),(0,_jsxRuntime.jsx)(_framerMotion.motion.div,{animate:{visibility:["hidden","visible"],opacity:[0,1]},transition:{type:"spring",repeat:Infinity,repeatType:"loop",duration:.8},children:cursor?cursor:"_"})]})}const _default=_react.default.memo(Typing);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useEffect,useRef,useState}from"react";import{motion}from"framer-motion";function Album({children,text,subText,tag,duration=.6,...props}){const[isHover,setIsHover]=useState(false);const[shadowSize,setShadowSize]=useState({width:0,height:0});const containerRef=useRef(null);useEffect(()=>{const bounds=containerRef.current.getBoundingClientRect();setShadowSize({width:bounds.width,height:bounds.height})},[]);return _jsxs(motion.div,{ref:containerRef,initial:{width:"max-content",height:"max-content",position:"relative",cursor:"pointer",overflow:"hidden"},onHoverStart:()=>{setIsHover(true)},onHoverEnd:()=>{setIsHover(false)},...props,children:[tag&&_jsx(motion.div,{initial:{position:"absolute",top:"0px",left:"0px",padding:"0 8px",borderRadius:"0 0 4px",background:"#ffd75a",lineHeight:"28px",zIndex:3},children:tag}),_jsx(motion.div,{initial:{opacity:.5,zIndex:1},animate:{width:shadowSize.width,height:shadowSize.height,position:"absolute",opacity:isHover?1:.5,borderRadius:"3px",background:"linear-gradient(rgba(0,0,0,0) 0%,rgba(0,0,0,.25) 70%,rgba(0,0,0,.65) 100%)"},transition:{duration,width:{duration:0},height:{duration:0}}}),_jsxs(motion.div,{initial:{width:"100%",height:"100%",padding:"8px"},children:[_jsxs(motion.div,{initial:{position:"absolute",bottom:"8px",left:"16px",zIndex:2},children:[text,_jsx(motion.div,{initial:{height:"0px",opacity:0,zIndex:2,margin:"8px 0px"},animate:{height:isHover?"max-content":"0px",opacity:isHover?1:0,margin:isHover?"12px 0px":"8px 0px"},transition:{duration},children:subText})]}),_jsx(motion.div,{animate:{scale:isHover?1.05:1},transition:{duration},children:children})]})]})}export default Album;
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useEffect,useRef,useState}from"react";import{motion}from"framer-motion";function Album({children,text,subText,tag,duration=.6,shadow=[.5,1],scaleSize=1.1,...props}){const[isHover,setIsHover]=useState(false);const[shadowSize,setShadowSize]=useState({width:0,height:0});const[from,to]=shadow;const containerRef=useRef(null);useEffect(()=>{const bounds=containerRef.current.getBoundingClientRect();setShadowSize({width:bounds.width,height:bounds.height})},[]);return _jsxs(motion.div,{ref:containerRef,initial:{width:"max-content",height:"max-content",position:"relative",cursor:"pointer",overflow:"hidden"},onHoverStart:()=>{setIsHover(true)},onHoverEnd:()=>{setIsHover(false)},...props,children:[tag&&_jsx(motion.div,{initial:{position:"absolute",top:"0px",left:"0px",padding:"0 8px",borderRadius:"0 0 4px",background:"#ffd75a",lineHeight:"28px",zIndex:3},children:tag}),_jsx(motion.div,{initial:{opacity:.5,zIndex:1},animate:{width:shadowSize.width,height:shadowSize.height,position:"absolute",opacity:isHover?to:from,borderRadius:"3px",background:"linear-gradient(rgba(0,0,0,0) 0%,rgba(0,0,0,.25) 70%,rgba(0,0,0,.65) 100%)"},transition:{duration,width:{duration:0},height:{duration:0}}}),_jsxs(motion.div,{initial:{width:"100%",height:"100%",padding:"8px"},children:[_jsxs(motion.div,{initial:{position:"absolute",bottom:"8px",left:"16px",zIndex:2},children:[text,_jsx(motion.div,{initial:{height:"0px",opacity:0,zIndex:2,margin:"8px 0px"},animate:{height:isHover?"max-content":"0px",opacity:isHover?1:0,margin:isHover?"12px 0px":"8px 0px"},transition:{duration},children:subText})]}),_jsx(motion.div,{animate:{scale:isHover?scaleSize:1},transition:{duration},children:children})]})]})}export default Album;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useMemo}from"react";import{motion}from"framer-motion";function Typing({text,speed,conatinerStyle,textStyle,cursor}){const characters=useMemo(()=>{return text.split("")},[text]);const typingSpeend=useMemo(()=>{return speed<=0?1:1/speed},[speed]);return _jsxs(motion.div,{initial:{display:"flex",alignItems:"flex-end"},style:conatinerStyle,children:[characters.map((character,index)=>{return _jsx(motion.div,{initial:{display:"none"},animate:{display:"block"},transition:{delay:(index+1)*typingSpeend},style:textStyle,children:character!==" "?_jsx(motion.span,{children:character}):_jsx(motion.span,{children:"\xa0"})},index)}),_jsx(motion.div,{animate:{opacity:[0,1]},transition:{type:"spring",repeat:Infinity,repeatType:"loop",duration:1},children:cursor?cursor:"_"})]})}export default Typing;
import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import React,{useEffect,useMemo,useRef,useState}from"react";import{motion}from"framer-motion";function Typing({text,speed,conatinerStyle,textStyle,cursor,deleteDelay=3}){const[characters,setCharacters]=useState([]);const typingSpeend=useMemo(()=>{return speed<=0?1:1/speed},[speed]);const inputRef=useRef(-1);const deleteRef=useRef(-1);const[flag,setFlag]=useState(true);const[index,setIndex]=useState(0);useEffect(()=>{const texts=text.split("");if(flag){inputRef.current=window.setInterval(()=>{if(index===texts.length-1){window.clearInterval(inputRef.current);window.setTimeout(()=>{setFlag(false)},deleteDelay*1e3)}setCharacters(s=>[...s,texts[index]]);setIndex(i=>i+1)},typingSpeend*1e3)}if(!flag){deleteRef.current=window.setInterval(()=>{if(index===0){setFlag(true);window.clearInterval(deleteRef.current)}setCharacters(s=>s.filter((c,i)=>i<s.length-2));setIndex(i=>i-1)},typingSpeend*300)}return()=>{window.clearInterval(inputRef.current);window.clearInterval(deleteRef.current)}},[text,typingSpeend,flag,index,deleteDelay]);return _jsxs(motion.div,{initial:{display:"flex",alignItems:"flex-end"},style:conatinerStyle,children:[characters.map((character,index)=>{return _jsx(motion.div,{style:textStyle,initial:{visibility:"hidden"},animate:{visibility:["hidden","visible"]},children:character!==" "?_jsx(motion.span,{children:character}):_jsx(motion.span,{children:"\xa0"})},index)}),_jsx(motion.div,{animate:{visibility:["hidden","visible"],opacity:[0,1]},transition:{type:"spring",repeat:Infinity,repeatType:"loop",duration:.8},children:cursor?cursor:"_"})]})}export default React.memo(Typing);
//# sourceMappingURL=index.js.map
/// <reference types="react" />
import { AlbumProps } from "../";
declare function Album({ children, text, subText, tag, duration, ...props }: AlbumProps): JSX.Element;
declare function Album({ children, text, subText, tag, duration, shadow, scaleSize, ...props }: AlbumProps): JSX.Element;
export default Album;

@@ -9,2 +9,4 @@ import { HTMLMotionProps } from "framer-motion";

duration?: number;
shadow?: [number, number];
scaleSize?: number;
} & HTMLMotionProps<"div">;

@@ -17,2 +19,3 @@ export declare type TypingProps = {

cursor?: React.ReactNode;
deleteDelay?: number;
};

@@ -1,4 +0,5 @@

/// <reference types="react" />
import React from "react";
import { TypingProps } from "../type";
declare function Typing({ text, speed, conatinerStyle, textStyle, cursor, }: TypingProps): JSX.Element;
export default Typing;
declare function Typing({ text, speed, conatinerStyle, textStyle, cursor, deleteDelay, }: TypingProps): JSX.Element;
declare const _default: React.MemoExoticComponent<typeof Typing>;
export default _default;

@@ -10,2 +10,4 @@ import { HTMLMotionProps } from "framer-motion";

duration?: number;
shadow?: [number, number];
scaleSize?: number;
} & HTMLMotionProps<"div">;

@@ -19,2 +21,3 @@

cursor?: React.ReactNode;
deleteDelay?: number;
};
{
"name": "motion-effect",
"version": "0.1.0",
"version": "0.1.1",
"private": false,

@@ -5,0 +5,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc