限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery支持自定义设置图片切割合成动画特效

所属分类: 网页特效-图片特效&上传    2024-12-04 11:09:51

jquery支持自定义设置图片切割合成动画特效 ie兼容10
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery支持自定义设置图片切割合成动画特效(共4个文件)

    • index.html

使用方法

  • code
  • source
  1. var Split = function() {
  2. this.$t = $(".split");
  3. this.gridX = 6;
  4. this.gridY = 4;
  5. this.w = this.$t.width();
  6. this.h = this.$t.height();
  7. this.img = $("img", this.$t).attr("src");
  8. this.delay = 0.05;
  9. this.create = function() {
  10. $("div", this.$t).remove();
  11. for (x = 0; x < this.gridX; x++) {
  12. for (y = 0; y < this.gridY; y++) {
  13. var width = this.w / this.gridX * 101 / this.w + "%",
  14. height = this.h / this.gridY * 101 / this.h + "%",
  15. top = this.h / this.gridY * y * 100 / this.h + "%",
  16. left = this.w / this.gridX * x * 100 / this.w + "%",
  17. bgPosX = -(this.w / this.gridX * x) + "px",
  18. bgPosY = -(this.h / this.gridY * y) + "px";
  19. $("<div />")
  20. .css({
  21. top: top,
  22. left: left,
  23. width: width,
  24. height: height,
  25. backgroundImage: "url(" + this.img + ")",
  26. backgroundPosition: bgPosX + " " + bgPosY,
  27. backgroundSize: this.w + "px",
  28. transitionDelay: x * this.delay + y * this.delay + "s"
  29. })
  30. .appendTo(this.$t);
  31. }
  32. }
  33. };
  34. this.create();
  35. this.$t
  36. .on("click", function() {
  37. $(this).toggleClass("active");
  38. })
  39. .click();
  40. };
  41. window.onload = function() {
  42. var split = new Split();
  43. var gui = (function datgui() {
  44. var gui = new dat.GUI();
  45. gui.add(split, "gridX", 1, 20).step(1).onChange(function(newValue) {
  46. split.create();
  47. });
  48. gui.add(split, "gridY", 1, 20).step(1).onChange(function(newValue) {
  49. split.create();
  50. });
  51. gui.add(split, "delay", 0, 0.3).step(0.01).onChange(function(newValue) {
  52. split.create();
  53. });
  54. return gui;
  55. })();
  56. };
var Split = function() {
  this.$t = $(".split");
  this.gridX = 6;
  this.gridY = 4;
  this.w = this.$t.width();
  this.h = this.$t.height();
  this.img = $("img", this.$t).attr("src");
  this.delay = 0.05;

  this.create = function() {
    $("div", this.$t).remove();

    for (x = 0; x < this.gridX; x++) {
      for (y = 0; y < this.gridY; y++) {
        var width = this.w / this.gridX * 101 / this.w + "%",
            height = this.h / this.gridY * 101 / this.h + "%",
            top = this.h / this.gridY * y * 100 / this.h + "%",
            left = this.w / this.gridX * x * 100 / this.w + "%",
            bgPosX = -(this.w / this.gridX * x) + "px",
            bgPosY = -(this.h / this.gridY * y) + "px";

        $("<div />")
          .css({
          top: top,
          left: left,
          width: width,
          height: height,
          backgroundImage: "url(" + this.img + ")",
          backgroundPosition: bgPosX + " " + bgPosY,
          backgroundSize: this.w + "px",
          transitionDelay: x * this.delay + y * this.delay + "s"
        })
          .appendTo(this.$t);
      }
    }
  };

  this.create();

  this.$t
    .on("click", function() {
    $(this).toggleClass("active");
  })
    .click();
};

window.onload = function() {
  var split = new Split();
  var gui = (function datgui() {
    var gui = new dat.GUI();
    gui.add(split, "gridX", 1, 20).step(1).onChange(function(newValue) {
      split.create();
    });
    gui.add(split, "gridY", 1, 20).step(1).onChange(function(newValue) {
      split.create();
    });
    gui.add(split, "delay", 0, 0.3).step(0.01).onChange(function(newValue) {
      split.create();
    });
    return gui;
  })();
};

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 图片特效&上传

javascript使用canvas画布调整图片大小

可以给图片指定一个固定的宽度高度,并将在画布上创建和图片一样的大小。此特效有助于在不更改原始图片文件的情况下调整图片尺寸。
  图片特效&上传
 1339  0

jquery幻灯片式图片/文本文字内容播放器插件

一款带幻灯片效果的图片播放器特效代码,让图片及文字就像视频播放一样的效果。
  图片特效&上传
 2325  0

jquery响应式图片滚动插件按钮控制图片滚动

响应式布局设计的幻灯片代码,自适应所有分辨率显示,带左右切换功能。
  图片特效&上传
 5348  0

jquery轻量级指定区域内图片可拖拽滚动特效代码

一款图片拖动滚动插件,在自定义宽度区域内,可使用鼠标拖动滚动和滑动滚动图片特效。
  图片特效&上传
 5501  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论