npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fj-timeline-storyboard

v1.0.2

Published

元素时间线交互模块

Downloads

1

Readme

Getting Started

npm install fj-modal --registry http://192.168.0.150:4876

basic use


  // 使用当前核心库数据更新时间线数据用于交互计算
  function decodeToTimeline() {
    let {
      mainLayer,
      subLayer,
      subAudioLayer,
      bgmLayer,
    } = canvas.getAllLayer();

    let createLayerData = (layer) => {
      return layer.map(id => {
        let graph = canvas.getGraphById(id);
        return wrapBrickData(graph);
      })
    };

    FJTimelineStore.decode({
      mainLayer: createLayerData(mainLayer),
      subLayer: createLayerData(subLayer),
      subAudioLayer: createLayerData(subAudioLayer),
      bgmLayer: createLayerData(bgmLayer),
    })
  }

  // 返回时间线的交互数据用于更新核心库
  function encodeFromTimeline() {
    let layer = FJTimelineStore.encode();
    let _layer = canvas.getAllLayer();
    let updateLayer = (timelineLayer, canvasLayer) => {
      // 清空当前层
      canvasLayer.length = 0;
      let cache = {};
      timelineLayer.forEach(brick => {
        let copyCacheGraph = FJTimelineStore.getCopyCache() && FJTimelineStore.getCopyCache().cache;
        let graph = cache[brick.id] || canvas.getGraphById(brick.id) || copyCacheGraph;
        if (graph) {
          canvas.remove(graph);
          if (brick.cloned) {
            cache[brick.id] = cache[brick.id] || graph;
            graph = graph.clone();
          }

          graph.decode({
            startTime: brick.startTime,
            endTime: brick.endTime,
            delay: brick.delay,
          });

          if (graph.type === FJCoreConstant.TEXT_ANIMATION) {
            graph.createAni();
          }

          canvas.add(graph);
          canvasLayer.push(graph.id);
        }
      });
    };

    updateLayer(layer.mainLayer, _layer.mainLayer);
    updateLayer(layer.subLayer, _layer.subLayer);
    updateLayer(layer.subAudioLayer, _layer.subAudioLayer);
    updateLayer(layer.bgmLayer, _layer.bgmLayer);
  }

  // 在使用FJTimelineStore的接口时,需要将先就用FJTimelineStore.decode()更新时间线的相关数据
  // 在交互计算完成后获取FJTimelineStore.encode()的返回值更新自身的核心库
  decodeToTimeline();
  let {adsorptionLine, exchangeId} = FJTimelineStore.dragTimeline(id, dragData);
  encodeFromTimeline();

API

| Name | Description | Param | Return | | --- | ----------- | -------- | ------------- | dragTimeline | 拖动时间线 | (id, dragData) | - | newTimeline | 新建时间线 | - | - | deleteTimeline | 删除时间线 | (id, withFollowGraph) | - | splitTimeline | 分割时间线 | (id, progress) | boolean | copyTimeline | 复制时间线 | (cache, brickData, layerType) | - | pasteTimeline | 粘贴时间线 | (time) | boolean, any | hasCopyCache | 是否存在复制缓存 | - | boolean | getCopyCache | 返回复制缓存 | - | null, any | clearCopyCache | 清除复制缓存 | - | - | timeToPixel | 时间转换像素 | (value) | number | pixelToTime | 像素转换时间 | (value) | number | getMaxUnitConversion | 返回最大时间/像素比例 | - | number | getMinUnitConversion | 返回最小时间/像素比例 | - | number | setUnitConversion | 设置时间/像素比例 | (value) | - | getUnitConversion | 返回时间/像素比例 | - | number | flush | 根据当前数据返回视图 | - | - | getIgnores | 返回过滤的时间线 | - | array | setIgnores | 设置过滤的时间线 | (value) | - | clearIgnores | 清除过滤的时间线 | - | - | calcRectWidth | 计算总宽度 | (rects) | number | calcRectHeight | 计算总高度 | (rects) | number | encode | 返回交互后整个时间线数据 | - | object | decode | 更新当前时间线数据用于交互 | (layer) | -