PageSourceSearch

https://www.mkic.sk/bundles/headerfooter/js/slideshow2/js/slideshow.kenburns.js?v=v6.5.0

js mkic.sk collected 2026-10-06 18:50:51 UTC 3,781 bytes, 106 lines download raw bytes

1/**
2Script: Slideshow.KenBurns.js
3	Slideshow.KenBurns - KenBurns extension for Slideshow, includes zooming and panning effects.
4
5License:
6	MIT-style license.
7
8Copyright:
9	Copyright (c) 2008 [Aeron Glemann](http://www.electricprism.com/aeron/).
10	
11Dependencies:
12	Slideshow.
13*/
14(function () {
15    Slideshow.KenBurns = new Class({
16        Extends: Slideshow,
17
18        options: {
19            pan: [100, 100],
20            zoom: [50, 50],
21        },
22
23        /**
24	Constructor: initialize
25		Creates an instance of the Slideshow class.
26
27	Arguments:
28		element - (element) The wrapper element.
29		data - (array or object) The images and optional thumbnails, captions and links for the show.
30		options - (object) The options below.
31
32	Syntax:
33		var myShow = new Slideshow.KenBurns(element, data, options);
34	*/
35
36        initialize: function (el, data, options) {
37            options = options || {};
38            options.overlap = true;
39            options.resize = 'fill';
40            ['pan', 'zoom'].each(function (p) {
41                if (this[p] != undefined) {
42                    if (typeOf(this[p]) != 'array') this[p] = [this[p], this[p]];
43                    this[p].map(function (n) {
44                        return (n.toInt() || 0).limit(0, 100);
45                    });
46                }
47            }, options);
48            this.parent(el, data, options);
49        },
50
51        /**
52	Private method: show
53		Does the slideshow effect.
54	*/
55
56        _show: function (fast) {
57            if (!this.image.retrieve('morph')) {
58                $$(this.a, this.b).set({
59                    tween: {
60                        duration: this.options.duration,
61                        link: 'cancel',
62                        onStart: this._start.bind(this),
63                        onComplete: this._complete.bind(this),
64                        property: 'opacity',
65                    },
66                    morph: {
67                        duration: this.options.delay + this.options.duration * 2,
68                        link: 'cancel',
69                        transition: 'linear',
70                    },
71                });
72            }
73            this.image.set('styles', { bottom: 'auto', left: 'auto', right: 'auto', top: 'auto' });
74            var props = ['top left', 'top right', 'bottom left', 'bottom right'][this.counter % 4].split(' ');
75            this.image.setStyles([0, 0].associate(props));
76            var src = this.data.images[this._slide].replace(/([^?]+).*/, '$1'),
77                cache = this.cache[src];
78            dh = this.height / cache.height;
79            dw = this.width / cache.width;
80            delta = dw > dh ? dw : dh;
81            var values = {},
82                zoom = Number.random.apply(Number, this.options.zoom) / 100.0 + 1,
83                pan = Math.abs(Number.random.apply(Number, this.options.pan) / 100.0 - 1);
84            ['height', 'width'].each(function (prop, i) {
85                var e = Math.ceil(cache[prop] * delta),
86                    s = (e * zoom).toInt();
87                values[prop] = [s, e];
88                if (dw > dh || i) {
89                    e = this[prop] - this.image[prop];
90                    s = (e * pan).toInt();
91                    values[props[i]] = [s, e];
92                }
93            }, this);
94            var paused = (this.firstrun && this.options.paused) || this.paused;
95            if (fast || paused) {
96                this._center(this.image);
97                this.image.get('morph').cancel();
98                if (paused) this.image.get('tween').cancel().set(0).start(1);
99                else this.image.get('tween').cancel().set(1);
100            } else {
101                this.image.get('morph').start(values);
102                this.image.get('tween').set(0).start(1);
103            }
104        },
105    });
106})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.