How to use the karma/case.constant.js.jpg100px function in karma

To help you get started, we’ve selected a few karma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github c-zhuo / easycanvas / test / cases / feature.perf-jumpRenderOfCoveredSprite.js View on Github external
import Easycanvas from 'src/index.js';
import constants from 'karma/case.constant.js';

var $canvas = document.createElement('canvas');
$canvas.width = 888;
$canvas.height = 888;
document.body.appendChild($canvas);

var $Painter = new Easycanvas.Painter();
$Painter.register($canvas);
$Painter.start();

var sprites = {};

Easycanvas.ImgLoader.cacheCanvas = Math.random() < 0.5;
Easycanvas.ImgLoader(constants.jpg100px, function (img) {
    // 跳过绘制0个
    sprites.type1 = [];
    for (var i = 0; i < 2; i++) {
        var sprite = $Painter.add({
            content: {
                img: img,
            },
            style: {
                left: 200, top: 200,
                width: 400, height: 300,
                opacity: 0.5,
                zIndex: 1,
            },
        });
        sprites.type1.push(sprite);
    }
github c-zhuo / easycanvas / test / cases / feature.perf-jumpRenderOfCoveredSprite.js View on Github external
Easycanvas.ImgLoader(constants.jpg100px, function (img) {
    // 跳过绘制0个
    sprites.type4 = [];
    for (var i = 0; i < 16; i++) {
        var sprite = $Painter.add({
            content: {
                img: i % 2 ? img : constants.jpg100px,
            },
            style: {
                left: 200, top: 200,
                width: 200, height: 300,
                opacity: 0.6,
                zIndex: 4,
            },
        });
        sprites.type4.push(sprite);
    }
});
github c-zhuo / easycanvas / test / cases / feature.perf-jumpRenderOfCoveredSprite.js View on Github external
var sprite = $Painter.add({
            content: {
                img: img,
            },
            style: {
                left: 200, top: 200,
                width: 200, height: 300,
                zIndex: 2,
            },
        });
        sprites.type2.push(sprite);
    }
});

Easycanvas.ImgLoader.cacheCanvas = false;
Easycanvas.ImgLoader(constants.jpg100px, function (img) {
    // 跳过绘制8-1=7个
    sprites.type3 = [];
    for (var i = 0; i < 8; i++) {
        var sprite = $Painter.add({
            content: {
                img: img,
            },
            style: {
                left: 200, top: 200,
                width: 200, height: 300,
                zIndex: 3,
            },
        });
        sprites.type3.push(sprite);
    }
});
github c-zhuo / easycanvas / test / cases / feature.perf-jumpRenderOfOutside.js View on Github external
import Easycanvas from 'src/index.js';
import constants from 'karma/case.constant.js';

var $canvas = document.createElement('canvas');
$canvas.width = 888;
$canvas.height = 888;
document.body.appendChild($canvas);

var $Painter = new Easycanvas.Painter();
$Painter.register($canvas);
$Painter.start();

var shouldBeJumped = [];
var shouldBePrinted = [];

Easycanvas.ImgLoader(constants.jpg100px, function (img) {
    shouldBeJumped.push($Painter.add({
        name: '画在外部',
        content: {
            img: img,
        },
        style: {
            left: -110, top: 200,
            width: 100, height: 200,
            zIndex: 1, locate: 'lt',
        },
    }));

    shouldBePrinted.push($Painter.add({
        name: '部分在外部',
        content: {
            img: img,