summaryrefslogtreecommitdiff
path: root/tests/image_blend_many_smooth_same_scaled.lua
blob: 7b2ba07e619082ddc84917404bf4b1949d7d4f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
local ffi = require("ffi")
local ffi_new = ffi.new
local util = require("util")
local levas = util.get_lib("evas")

local sin, cos = math.sin, math.cos

return function(ui, variant)
    return "blend.png", "Image Blend Many Smooth Down Scaled", 10.000,
    function()
        local itern    = 8192
        local slow     = 5.0
        local o_images = {}
        local win_w, win_h = ui.win_w, ui.win_h
        local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
        ui.func_set(util.del_objs(o_images), function(t, f)
            for i = 1, itern do
                local o = o_images[i]
                levas.evas_object_geometry_get(o, nil, nil, w, h)
                local x = (win_w / 2) - (w[0] / 2)
                    + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (win_w / 2)
                local y = (win_h / 2) - (h[0] / 2)
                    + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (win_h / 2)
                levas.evas_object_move(o, x, y)
            end
        end)
        local evas = ui.evas
        for i = 1, itern do
            local o = levas.evas_object_image_add(evas)
            o_images[i] = o
            local n = util.random() % 100
            local w = 3 + ((n * (60 - 3)) / 100)
            local h = 4 + ((n * (80 - 4)) / 100)
            levas.evas_object_image_file_set(o, util.build_path("logo.png"),
                nil)
            levas.evas_object_image_smooth_scale_set(o, 1)
            levas.evas_object_resize(o, w, h)
            levas.evas_object_image_fill_set(o, 0, 0, w, h)
            levas.evas_object_show(o)
        end
    end
end