SVGAnimatedInteger: thuộc tính baseVal
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Thuộc tính baseVal của giao diện SVGAnimatedInteger đại diện cho giá trị cơ sở (không hoạt hình) của một <integer> có thể hoạt hình.
Một số thuộc tính, như thuộc tính numOctaves của phần tử <feTurbulence> hoặc thuộc tính order của phần tử <feConvolveMatrix>, chấp nhận số nguyên long làm giá trị. Thuộc tính này cung cấp quyền truy cập vào trạng thái tĩnh không hoạt hình của thuộc tính dưới dạng số.
Giá trị
Một long; giá trị cơ sở (không hoạt hình) của thuộc tính được phản chiếu.
Ví dụ
js
const feTurbulence = document.querySelector("feTurbulence");
// Đặt thuộc tính 'numOctaves' có thể hoạt hình
feTurbulence.setAttribute("numOctaves", "4");
// Truy cập đối tượng SVGAnimatedInteger
const animatedInteger = feTurbulence.numOctaves;
// Lấy giá trị cơ sở
console.log(animatedInteger.baseVal); // Đầu ra: 4
// Sửa đổi giá trị cơ sở
animatedInteger.baseVal = 6;
// Xác minh giá trị thuộc tính được phản chiếu
console.log(feTurbulence.getAttribute("numOctaves")); // Đầu ra: "6"
Thông số kỹ thuật
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # __svg__SVGAnimatedInteger__baseVal> |